gdk/toplevelsize: Don't complain if only shadow extends out of bounds
authorJonas Ådahl <jadahl@gmail.com>
Wed, 2 Dec 2020 09:57:32 +0000 (10:57 +0100)
committerJonas Ådahl <jadahl@gmail.com>
Mon, 7 Dec 2020 08:46:39 +0000 (09:46 +0100)
gdk/gdktoplevelsize.c

index 7cd09ebd5ee30ba6b579291ffc0c234ac967afa7..a1c6ded32d47b6c10f01d837fe973067ae4a77f6 100644 (file)
@@ -135,15 +135,24 @@ gdk_toplevel_size_set_margin (GdkToplevelSize *size,
 void
 gdk_toplevel_size_validate (GdkToplevelSize *size)
 {
+  int geometry_width, geometry_height;
+
   if (size->min_width > size->bounds_width ||
       size->min_height > size->bounds_height)
     g_warning ("GdkToplevelSize: min_size (%d, %d) exceeds bounds (%d, %d)",
                size->min_width, size->min_height,
                size->bounds_width, size->bounds_height);
 
-  if (size->width > size->bounds_width ||
-      size->height > size->bounds_height)
-    g_warning ("GdkToplevelSize: size (%d, %d) exceeds bounds (%d, %d)",
+  geometry_width = size->width;
+  geometry_height = size->height;
+  if (size->margin.is_valid)
+    {
+      geometry_width -= size->margin.left + size->margin.right;
+      geometry_height -= size->margin.top + size->margin.bottom;
+    }
+  if (geometry_width > size->bounds_width ||
+      geometry_height > size->bounds_height)
+    g_warning ("GdkToplevelSize: geometry size (%d, %d) exceeds bounds (%d, %d)",
                size->width, size->height,
                size->bounds_width, size->bounds_height);